'''
Author: 红色梧桐 940120450@qq.com
Date: 2024-09-02 22:53:02
LastEditors: 红色梧桐 940120450@qq.com
LastEditTime: 2024-09-05 20:46:28
FilePath: \myReader\applications\tasks\wx_tasks.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''

from datetime import datetime, timedelta
from applications.services.wx import start_wechat_task_func, write_wx_message_to_mysql


def start_task(scheduler):

    @scheduler.scheduled_job('interval', minutes=1, max_instances=10, misfire_grace_time=None)
    # 每分钟获取一次微信消息
    def start_wechat_task():
        start_wechat_task_func()
# 
    @scheduler.scheduled_job('date', run_date=datetime.now() + timedelta(milliseconds=5), max_instances=10, misfire_grace_time=None)
    # 每分钟获取一次微信消息
    def write_wx_message_to_mysql_task():
        write_wx_message_to_mysql()